package com.xinqi.modules.prepare.question.service;

import com.xinqi.common.base.response.PageInfo;
import com.xinqi.common.base.response.Param;
import com.xinqi.modules.prepare.question.dto.req.PrepareFolderQuestionSortDTO;
import com.xinqi.modules.prepare.question.dto.req.PrepareJoinQuestionFolderDTO;
import com.xinqi.modules.prepare.question.dto.req.PrepareQuestionFolderCreateDTO;
import com.xinqi.modules.prepare.question.dto.req.PrepareQuestionFolderDeleteDTO;
import com.xinqi.modules.prepare.question.dto.req.PrepareQuestionFolderIsExistNameDTO;
import com.xinqi.modules.prepare.question.dto.req.PrepareQuestionFolderQueryDTO;
import com.xinqi.modules.prepare.question.dto.req.PrepareQuestionFolderUpdateDTO;
import com.xinqi.modules.prepare.question.dto.rsp.PrepareQuestionFolderResultDTO;
import org.springframework.transaction.annotation.Transactional;

import javax.validation.Valid;
import java.util.List;

/**
 * 备课区试题夹服务层
 *
 * @author: system
 * @date: 2023/03/19
 */
public interface PrepareQuestionFolderService {
    /**
     * 分页查询 备课区试题夹数据
     */
    PageInfo<PrepareQuestionFolderResultDTO> page(Param pageable, PrepareQuestionFolderQueryDTO query);

    /**
     * 查询 备课区试题夹数据
     */
    List<PrepareQuestionFolderResultDTO> find(PrepareQuestionFolderQueryDTO query);

    /**
     * 根据id查询 备课区试题夹数据
     */
    PrepareQuestionFolderResultDTO findById(Long id);

    /**
     * 新增 备课区试题夹数据
     */
    Long insert(@Valid PrepareQuestionFolderCreateDTO dto);

    /**
     * 根据id修改 备课区试题夹数据
     */
    Boolean updateById(@Valid PrepareQuestionFolderUpdateDTO dto);

    Boolean isExistName(@Valid PrepareQuestionFolderIsExistNameDTO dto);

    Boolean isExistName(Long prepareId, String name, Long oldId);

    /**
     * 根据id删除 备课区试题夹数据
     */
    Boolean deleteById(Long id);

    /**
     * 根据id删除 备课区试题夹数据
     */
    @Transactional(rollbackFor = Exception.class)
    Boolean deleteById(@Valid PrepareQuestionFolderDeleteDTO dto);

    @Transactional(rollbackFor = Exception.class)
    Boolean delete(Long prepareId, List<Long> ids);

    @Transactional(rollbackFor = Exception.class)
    Boolean joinQuestionFolder(@Valid PrepareJoinQuestionFolderDTO dto);

    @Transactional(rollbackFor = Exception.class)
    Boolean removeQuestionFolder(@Valid PrepareJoinQuestionFolderDTO dto);

    @Transactional(rollbackFor = Exception.class)
    Boolean sortFolderQuestion(@Valid PrepareFolderQuestionSortDTO dto);
}
